from django.contrib.auth.models import Permission,ContentType

from rest_framework import serializers


class PermissionSerializer(serializers.ModelSerializer):
    class Meta:
        # 指定生成序列化字段的模型类
        model = Permission
        # 指定字段
        fields = "__all__"


class ContentTypeSerializer(serializers.ModelSerializer):
    """
    权限类型序列化器
    """
    name = serializers.CharField(read_only=True)
    class Meta:
        # 指定生成序列化字段的模型类
        model = ContentType
        # 指定字段
        fields = ('name','id')
        # fields = "__all__"